package com.tang.websocket.v1.session;

import com.tang.websocket.v1.message.WebSocketMessage;
import com.tang.websocket.v1.session.WebSocketSession;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Map;

/**
 * @author Tang
 * @classname WebSocketSessionDecorator
 * @description [  ]
 * @date 2022/11/29 10:22
 */
public class WebSocketSessionDecorator implements WebSocketSession {

    private final WebSocketSession proxyWebSocketSession;

    public WebSocketSessionDecorator(WebSocketSession proxyWebSocketSession) {
        this.proxyWebSocketSession = proxyWebSocketSession;
    }

    @Override
    public String getId() {
        return proxyWebSocketSession.getId();
    }

    @Override
    public void sendMessage(WebSocketMessage<?> message) throws IOException {
        proxyWebSocketSession.sendMessage(message);
    }

    @Override
    public Map<String, Object> getAttributes() {
        return proxyWebSocketSession.getAttributes();
    }

    @Override
    public Map<String, String> getPathParameters() {
        return proxyWebSocketSession.getPathParameters();
    }

    @Override
    public InetSocketAddress getLocalAddress() {
        return null;
    }

    @Override
    public InetSocketAddress getRemoteAddress() {
        return null;
    }

    @Override
    public boolean isOpen() {
        return proxyWebSocketSession.isOpen();
    }

    @Override
    public void close() throws IOException {
        proxyWebSocketSession.close();
    }
}
